473,418 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Unicode and querystring!

Is it possible to put a unicode string on a querystring? How do I
escape/unescape this? I read values from a dropown list which may have any
UTF-8 character (chinese, greek or whatever).

If it is not possible I guess I have to post in the value instead but I
would like to keep the code as it is and only change the escape functions
which only works for ISO Latin characterset as far as I know.
Regards
/Hans
Jul 20 '05 #1
2 5490


Hans wrote:
Is it possible to put a unicode string on a querystring? How do I
escape/unescape this? I read values from a dropown list which may have any
UTF-8 character (chinese, greek or whatever).

If it is not possible I guess I have to post in the value instead but I
would like to keep the code as it is and only change the escape functions
which only works for ISO Latin characterset as far as I know.


With Netscape 6/7, Mozilla, IE5.5/6 and with Opera 7 there is
encodeURIComponent(string)
which is capable of processing Unicode strings, for instance
var string = '€';
encodeURIComponent(string)
yields
%E2%82%AC
which is an escaped UTF-8 encoding. It is then up to you to handle that
properly on the server, if you have ASP on the server make sure you
install JScript 5.5 or 5.6 there and you can simply use
decodeURIComponent
In some browsers escape is also Unicode capable however it yields a
different result e.g.
var string = '€';
escape(string)
yields
%u20AC
which is % as the escape character, u for unicode and then the hex code
of the Unicode code value.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
Thanks Martin!

/Hans
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Hans | last post by:
Hi! Can someone explain how ASP works when it comes to unicode characters on the querystring? See the testcode below. If you type in a chinese character in the first textbox and click "post" the...
3
by: Supratim | last post by:
Hi, For past few weeks I am working on a function that would take encoded Unicode characters from query string of http requests and then decode them back to Unicode numbers. I have full success...
1
by: lion | last post by:
my Problem: a query string passed into a html page doesn't display correctly on a mac I am just using html and javascript (no ASP, PHP or server side scripting) This is the query string:...
2
by: Beat Richli | last post by:
Hello i have following problem with ASP (using Interdev, Win2003 Server): if a special character is entered in a textbox, ASP or the Client Browser (IE 6) seems to convert this character in HTML...
4
by: Raterus | last post by:
Howdy, Simple question, but I can't figure out how to do it. I have a a page which is called initially with a querystring. After I get the querystring values, I don't need the querystring to...
12
by: Alex | last post by:
I have a question about determining if one QueryString keys exists. The idea is, if this key exists, than its presence is enough to indicate that its value is true. For example ... ...
2
by: phl | last post by:
Hello, I have aspx(say page.aspx) page which uses javascript to submit a form reload with some unicode characters,upon an button event e.g page.aspx?param=value I get this value in the...
0
by: prasanta.bhowmik | last post by:
Hello, I have an ASP.NET application which having some text boxs. data is filling frm the database. but sometime its having some unicode char, so when i am create querystring using javascript nd...
3
by: pingsheng | last post by:
Dear all, I have a form with dynamically created input fields. These fields go to next page for submitting into SQL database. The thing is all fields are the same but 4 fields. So each record...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.